package com.shenzw.common.utils

import spock.lang.*

/**
 *
 * @description:
 * @author: shenzw
 * @date: 2024/9/24
 */
class IDNumberUtilsTest extends Specification {

    @Unroll
    def "身份证号：#idNo 的生日，性别，年龄是：#result"() {
        expect: "when + then 组合"
        IDNumberUtils.getBirAgeSex(idNo) == result

        where: "表格方式测试不同的分支逻辑"
        idNo                 || result
        "430521199512107355" || ["birthday": "1995-12-10", "sex": "男", "age": "29"]
        "43052119951210"     || ["birthday": "1995-12-10", "sex": "女", "age": "28"]
        "430521199811107355" || ["birthday": "1998-11-10", "sex": "男", "age": "28"]
        "479281691111377"    || ["birthday": "1969-11-11", "sex": "男", "age": "51"]
    }
}